home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 2: Applications
/
Linux Cubed Series 2 - Applications.iso
/
circuits
/
irsim-ca.2
/
irsim-ca
/
irsim-cap-9.2
/
src
/
irsim
/
patchfile
< prev
next >
Wrap
Text File
|
1995-05-29
|
11KB
|
428 lines
23,24c23,24
< #define LSIZE 2000 /* max size of command line (in chars) */
< #define MAXARGS 100 /* maximum number of command-line arguments */
---
> #define LSIZE 1000000 /* max size of command line (in chars) */
> #define MAXARGS 50000 /* maximum number of command-line arguments */
38a39,43
> /* Don't skimp on the space here PLEASE. It causes problems on
> machines where a -short- is just 16 bits (most machines) */
> #if 1
> int nmin, nmax; /* min and max number of arguments */
> #else
39a45
> #endif
100a107
> public int count_InTrans = FALSE; /* count INPUT trans. (PEL 4/20/93) */
103a111,112
> public FILE *caplogfile = NULL; /* log file of cap transitions */
> public float totpower = 0; /* indicative of total power of chip */
371c380
< for( i = 0, s = "0ux1lUXhLUXH"; s[i] != '\0'; i++ )
---
> for( i = 0, s = "0ux1lUXhHUXL"; s[i] != '\0'; i++ )
800a810,835
> /*
> * set/clear captrace bit in node
> */
> private int xcaptrace( n, flag )
> nptr n;
> char *flag;
> {
> UnAlias( n );
>
> if( n->nflags & MERGED )
> {
> lprintf( stdout, "can't trace %s\n", pnode( n ) );
> return( 1 );
> }
>
> if( *flag == '+' )
> n->nflags |= CAPWATCHED;
> else if( n->nflags & CAPWATCHED )
> {
> lprintf( stdout, "%s was capwatched; not any more\n", pnode( n ) );
> n->nflags &= ~CAPWATCHED;
> }
>
> return( 1 );
> }
>
821a857,876
> /*
> * set/clear captrace bit in vector
> */
> private int vcaptrace( b, flag )
> register bptr b;
> char *flag;
> {
> register int i;
>
> if( *flag == '+' )
> b->traced |= CAPWATCHVECTOR;
> else
> {
> for( i = 0; i < b->nbits; i += 1 )
> b->nodes[i]->nflags &= ~CAPWATCHVECTOR;
> b->traced &= ~CAPWATCHVECTOR;
> }
> return( 1 );
> }
>
893a949,1065
> * Set flag that determines whether transitions on primary inputs will
> * contribute to overall transition count used to determine total
> * capacitance charged. (PEL 5/4/93)
> */
> private int setinputcap()
> {
> if( targc == 1 )
> {
> lprintf( stdout, "input capacitance transition accumulator is %s\n",
> (count_InTrans) ? "ON" : "OFF" );
> return( 0 );
> }
>
> if( str_eql( "on", targv[1] ) == 0 )
> count_InTrans = TRUE;
> else if( str_eql( "off", targv[1] ) == 0 )
> count_InTrans = FALSE;
> else
> error( filename, lineno, "don't know what '%s' means\n", targv[1] );
>
> return( 0 );
> }
>
>
> /*
> * mark nodes and vectors for cap tracing
> */
> private int setcaptrace()
> {
> apply( xcaptrace, vcaptrace, plus_minus );
> set_vec_nodes( CAPWATCHVECTOR );
> return( 0 );
> }
>
>
> /*
> * Helper routine for summing capacitance
> */
> private int sumcapdoit( n, capsum )
> register nptr n;
> float *capsum;
> {
> /* Don't UnAlias() before checking if it's an ALIAS node (PEL 5/31/93) */
> /* UnAlias( n ); */
>
> if( not (n->nflags & (MERGED | ALIAS)) )
> {
> *capsum += n->ncap;
> lprintf( stdout, "%-35s\t\%f\n", pnode( n ), n->ncap);
> }
>
> return( 0 );
> }
>
> /*
> * Helper routine for summing capacitance
> */
> private int sumcapdoit_eff( n, capsum )
> register nptr n;
> float *capsum;
> {
> if ( not (n->nflags & (MERGED | ALIAS)) )
> *capsum += n->ncap;
> if( VDD_node != NULL and str_eql( pnode( n ) , pnode( VDD_node ) ) == 0 )
> *capsum -= n->ncap;
> if( GND_node != NULL and str_eql( pnode( n ) , pnode( GND_node ) ) == 0 )
> *capsum -= n->ncap;
>
> return( 0 );
> }
>
> /*
> * Print sum of capacitance of nodes
> */
> private int sumcap()
> {
> float capsum = 0;
> lprintf( stdout, "\nNode \t\t\t\t\t Capacitance (pF)\n" );
> walk_net( sumcapdoit, (char *) &capsum );
> lprintf( stdout, "\n Sum of nodal capacitances (including Gnd and Vdd): %f pF",capsum );
>
> capsum = 0;
>
> walk_net( sumcapdoit_eff, (char *) &capsum );
> lprintf( stdout, "\n Sum of nodal capacitances: %f pF \n",capsum );
>
> return( 0 );
> }
>
>
> /*
> * Helper routine for zeroing transition counts (PEL 4/30/93).
> * Zeros even MERGE and ALIAS node transition counts since this can't
> * hurt anything.
> */
> private int zeropowerdoit( n )
> register nptr n;
> {
> n->trans = 0;
> n->trans01 = 0.0; /* PEL 5/3/93 */
>
> return( 0 );
> }
>
>
> /*
> * Zero totpower and transition counts for all nodes (PEL 4/30/93)
> */
> private int zeropower()
> {
> walk_net( zeropowerdoit, (char *) 0 );
> totpower = 0;
> return( 0 );
> }
>
>
> /*
1052,1053c1224,1225
< if( val == X_X ) val = X;
< if( n->npot != val )
---
>
> if( n->npot != (val == X_X) ? X : val )
1858a2031,2032
> public
> #define REPORT_CAP 0x10
1866c2040
< static char *rep[] = { "decay", "delay", "tau", "tcoord", NULL };
---
> static char *rep[] = { "decay", "delay", "tau", "tcoord", "cap", NULL };
1920a2095,2281
> /*
> * Helper routine for printing capacitance totals.
> */
>
> private int capsummer( n )
> register nptr n;
> {
> /* Don't UnAlias() before checking if it's an ALIAS node (PEL 5/31/93) */
> /* UnAlias( n ); */
>
> if( not (n->nflags & (MERGED | ALIAS)) )
> {
> lprintf( stdout, " %-35s\t%.3f\t%5d\t%f\t%f\n",
> pnode( n ),
> n->ncap,
> n->trans,
> n->trans*n->ncap,
> n->trans*n->ncap / totpower);
> }
> return( 0 );
> }
>
> /*
> * set up or finish off logfile
> */
> private int setcaplog()
> {
> if( caplogfile != NULL )
> {
> (void) fclose( caplogfile );
> caplogfile = NULL;
> walk_net( capsummer, (char *) 0 );
> }
>
> if( targc == 2 )
> {
> char *mode = "w";
> char *s = targv[1];
>
> if( *s == '+' )
> {
> s++;
> mode = "a";
> }
> if( (caplogfile = fopen( s, mode )) == NULL )
> error( filename, lineno, "cannot open log file %s for output\n", s );
> }
> return( 0 );
> }
>
> /*
> * Helper routine for capreport(). For a given node, print capacitive node
> * transition count. Include node even if it is an ALIAS'd node. Use nodal
> * 'naliases' count to distribute node capacitances equally across all
> * equivalent nodes. (PEL 5/28/93)
> */
> private int capreportdoit( n, CapReportFile )
> register nptr n;
> FILE *CapReportFile;
> {
> nptr root = n;
>
> UnAlias( root );
>
> if( not (n->nflags & MERGED) )
> {
> lprintf( CapReportFile, " %-35s\t%5d\t%.3f\t%f\t%f\n", pnode( n ),
> root->naliases+1,
> root->ncap/(root->naliases+1),
> root->trans01,
> root->trans01*root->ncap/(root->naliases+1));
> }
> return( 0 );
> }
>
> /*
> * Print report of all capacitive node transition counts. Report includes
> * all nodes including ALIAS'd nodes. Capacitances are distributed equally
> * across all equivalent nodes. (PEL 5/28/93)
> */
> private int capreport()
> {
> FILE *CapReportFile = NULL; /* file of effective caps. */
>
> if( targc == 1 )
> {
> walk_net( capreportdoit, (char *) stdout );
> }
> else
> {
> char *mode = "w";
> char *s = targv[1];
> if( *s == '+' )
> {
> s++;
> mode = "a";
> }
> if( (CapReportFile = fopen( s, mode )) == NULL )
> error( filename, lineno,
> "cannot open capreport file %s for output\n", s );
> walk_net( capreportdoit, (char *) CapReportFile );
> fclose( CapReportFile );
> }
> return( 0 );
> }
>
> /*
> * Helper routine to compute total capacitance charged. For a given
> * node, computes the physical capacitance of that node weighted by the number
> * of 0->1 transitions on that node, and adds this value to the total
> * capacitance charged. (PEL 5/3/93)
> */
> private int effcapsummer( n, capsum )
> register nptr n;
> float *capsum;
> {
> char *nname = pnode( n );
> char *is_merge;
>
> /* Don't UnAlias() before checking if it's an ALIAS node (PEL 5/31/93) */
> /* UnAlias( n ); */
>
> if( not (n->nflags & (MERGED | ALIAS)) )
> {
> *capsum += n->trans01*n->ncap;
> }
> return( 0 );
> }
>
> /*
> * Compute the total cap charged. That is, sum the physical capacitance
> * of each node weighted by the number of 0->1 transitions on that node
> * (PEL 5/4/93)
> */
> private int sumeffcap()
> {
> FILE *CapChgdFile = NULL; /* file of effective caps. */
> float capsum = 0;
>
> walk_net( effcapsummer, (char *) &capsum );
> if( targc == 1 )
> {
> lprintf( stdout, "Total capacitance charged: %f pF\n", capsum );
> }
> else
> {
> char *mode = "w";
> char *s = targv[1];
> if( *s == '+' )
> {
> s++;
> mode = "a";
> }
> if( (CapChgdFile = fopen( s, mode )) == NULL )
> error( filename, lineno, "cannot open cap file %s for output\n", s );
> fprintf( CapChgdFile, "Total capacitance charged: %f pF\n", capsum );
> fclose( CapChgdFile );
> }
> return( 0 );
> }
>
>
> /*
> * Output message to file. (PEL 10/7/93)
> */
> private int dofmsg()
> {
> FILE *MsgFile = NULL; /* target file for message */
> int n;
>
> char *mode = "w";
> char *s = targv[1];
> if( *s == '+' )
> {
> s++;
> mode = "a";
> }
> if( (MsgFile = fopen( s, mode )) == NULL )
> error( filename, lineno, "cannot open file %s for comment\n", s );
>
> for( n = 2; n < targc; n += 1 )
> fprintf( MsgFile, "%s ", targv[n] );
> fprintf( MsgFile, "\n" );
> fclose( MsgFile );
> return( 0 );
> }
>
2158c2519,2520
< UnAlias( n );
---
> /* Don't UnAlias() before checking if it's an ALIAS node (PEL 5/31/93) */
> /* UnAlias( n ); */
2217c2579,2580
< UnAlias( n );
---
> /* Don't UnAlias() before checking if it's an ALIAS node (PEL 5/31/93) */
> /* UnAlias( n ); */
3384a3708,3723
> { "caplogfile", setcaplog, 1, 2,
> "[[+]file] -> start/stop cap logfile (+file appends to file)" },
> { "captrace", setcaptrace, 2, MAXARGS,
> "[-]node/vector... -> start/stop cap tracing specified node/vector(s)"},
> { "sumcap", sumcap, 1, 2,
> "print out sum of capacitances of all nodes" },
> { "zeropower", zeropower, 1, 1, /* (PEL 4/30/93) */
> " -> zero current power estimate and nodal transition counts" },
> { "sumeffcap", sumeffcap, 1, 2, /* (PEL 5/4/93) */
> "[[+]file] -> output total effective capacitance charged from 0->1"},
> { "inputcap", setinputcap, 1, 2, /* (PEL 5/4/93) */
> "[on | off] -> enable/disable cap. contribs. from transitions on inputs"},
> { "capreport", capreport, 1, 2, /* (PEL 5/28/93) */
> "[[+]file] -> report cap. node trans. distributed over all node aliases"},
> { "fprint", dofmsg, 2, MAXARGS, /* (PEL 10/7/93) */
> "[+]file [text...] -> output specified text to file"},
3435c3774
< (void) fprintf( stderr, "[-s] prm_file {sim_file ..} [-cmd_file ..]\n" );
---
> (void) fprintf( stderr,"[-s] prm_file {sim_file ..} [-cmd_file ..]\n" );
3481c3820
< (void) fprintf( stdout, "*** IRSIM %s ***\n", version );
---
> (void) fprintf( stdout, "*** IRSIM-CAP %s ***\n", version );
3550a3890
>